<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/12/25 0025
  Time: 15:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.*" %>
<%@ page import="JSPBasicGrammar.mysql06.driver.MysqlDriver" %>

<html>
<head>
    <title>获取数据库数据</title>
</head>
<body>
<jsp:useBean id="msql" class="JSPBasicGrammar.mysql06.driver.MysqlDriver" scope="page"></jsp:useBean>
<%
MysqlDriver.Driver();//加载驱动
Connection cons=MysqlDriver.getCon();//获取Connection对象
Statement ment=cons.createStatement();//创建Statement对象
ResultSet set= ment.executeQuery("select * from servlet3");//创建ResultSet对象
//while(set.next()){
//	out.print(set.getString("username"));
//}
    if(set.next()){
        do{
            out.print("<li>"+set.getString(1)+"</li>");
        }while(set.next());
    }
%>

<script type="text/javascript">
    window.onload=function(){
        console.log("数据库jsp执行完毕!")
    }
</script>

</body>
</html>
